<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<html>
	<head>
		<title>规律排班设置录入</title>
		<base target="_self" />
		<jsp:include page="../../../webmanager/common/init.jsp"></jsp:include>
		<!-------样式文件调用注意不要改变顺序------>
		<link href="<%=path%>/themes/classic_blue/css/base.css" rel="stylesheet" type="text/css" />
		<link href="<%=path%>/themes/classic_blue/css/main_style.css" rel="stylesheet" type="text/css" />
		<!--[if lt IE 7]><link href="<%=path%>/themes/classic_blue/css/ie7hack.css" rel="stylesheet" type="text/css" media="screen"/><![endif]--><!--不可删--->
		<!--                       Javascripts 注意不要改变顺序                      -->
		<script type="text/javascript" SRC="<%=path%>/themes/classic_blue/js/jquery-1.6.2.min.js"></script>
		<!-- 组件template -->
		<script type="text/javascript" src="<%=path%>/themes/classic_blue/js/tpl.base.js"></script>	
		<!-- jQuery Configuration -->
		<script type="text/javascript" src="<%=path%>/themes/classic_blue/js/simpla.jquery.configuration.js"></script>
		<script type="text/javascript" src="<%=path%>/javaScript/My97DatePicker/WdatePicker.js"></script>	
		<script type="text/javascript" src="<%=path%>/javaScript/validForm/js/easy_validator.pack.js"></script>
		<script type="text/javascript" src="<%=path%>/javaScript/validForm/js/jquery.bgiframe.min.js"></script>
		<link  href="<%=path%>/javaScript/validForm/css/validate.css" rel="stylesheet" type="text/css" />	
	</head>
	<script type="text/javascript">
		//取消提示信息
		function cancelMessage(){
			if(document.getElementById("messageId")){
				var messageSpanId = document.getElementById("messageId");
				messageSpanId.innerHTML = "";
			}
		}	

		//页面关闭
		function winClose()
		{
			window.returnValue = "ok";
			window.close();
		}
	     
		//提交
		function doSubmit()
		{
			document.forms[0].action="glpbAction!createGlpb.do";
			document.forms[0].submit();		
			
		}
		//选择人员
		function selRyxx()
		{
		    var action="<%=path%>/webmanager/qxgl/selRy.jsp?tempid=" 
		    + Math.random();
		    win = window.showModalDialog(action,null,'dialogHeight=450px;dialogWidth=710px;status=no;scroll=no;help=no');
		    callback(win);
			//openWindow=window.open(action, "newwin", "height=450, width=700,toolbar=no,top=100,left=100,scrollbars=no,menubar=no,status=yes");
		}
		function callback(rValue){
			if(rValue!=null)
			{
				ryxx=rValue;
				document.forms[0].peopleNames.value=ryxx[0];
				document.forms[0].peopleIds.value=ryxx[1];
			}
		}
		
		//选择部门
		function selDept()
		{
			var action="<%=path%>/qxgl/selBmxx.do?selMutiDept=true&tempid=" + Math.random()
		    win = window.showModalDialog(action,null,'dialogHeight=450px;dialogWidth=310px;status=no;scroll=no;help=no');
		    callback(win);
		}
		function callback(rValue){
			if(rValue!=null)
			{
				ryxx=rValue;
				document.forms[0].deptNames.value=ryxx[0];
				document.forms[0].deptIds.value=ryxx[1];
			}
		}
		
		function deleteRow(rowIndex){
			var table = document.getElementById("table1");
			var table = document.getElementById("bcList"+rowIndex);	
			bcList
			var rowLength = table.rows.length;	
		}
		function addNewRow(){
			var table = document.getElementById("table1");	
			var rowLength = table.rows.length;	
			var select = document.getElementById("bcList0");			
			var row=table.insertRow(rowLength-1);
			 var cell1=row.insertCell(0);
			 var cell2=row.insertCell(1);
			 var cell3=row.insertCell(2);
			 var cell4=row.insertCell(3);
			 cell1.className="ui-form-cl2-l";
			 cell2.className="ui-form-cl2-r";
			 cell1.innerHTML="日期（<font color=\"red\">*</font>）:";
			 cell2.innerHTML="<input type=\"text\" id=\"rq"+parseInt(rowLength-1)+"\" name=\"kqGlpbxxList["+(rowLength-1)+"].rq\" onfocus=\"WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})\" class=\"Wdate\"/>";
			 cell3.className="ui-form-cl2-l";
			 cell4.className="ui-form-cl2-r";
			 cell3.innerHTML="班次（<font color=\"red\">*</font>）:";
			 cell4.innerHTML="<select id=\"bcList"+parseInt(rowLength-1)+"\" name=\"kqGlpbxxList["+(rowLength-1)+"].bc\"></select><input type=\"button\" value=\"删除\" onclick=\"javascript:deleteRow('"+(rowLength-1)+"')\">";
			 var newOptiions = document.getElementById("bcList"+parseInt(rowLength-1)).options;						
			for(var i =0;i<select.options.length;i++){				
				newOptiions[i] = new Option(select.options[i].text,select.options[i].value);					
			}
		}
		
		//生成功能按钮	
		//mpmenu1=new mMenu('','winClose()','script','<%=request.getContextPath()%>/images/img_ht_wz_44.gif','62','24','0','100','2');		
		</script>
	<body onload="showMessage()">
		<!--标题开始-->
		<div class="ui-title fn-clear">
			<span class="ui-title-icon fn-left"><img
					src="<%=path%>/themes/classic_blue/images/icons/note-pinned.png" />
			</span>
			<h2 class="ui-title-cnt fn-left">
				规律排班设置信息录入
			</h2>
			<div id="funbut">
				<a href="javascript:winClose()"><img src="<%=path%>/images/img_ht_wz_44.gif" style="width:62;height:24;"></a>
		    </div>
		</div>
		<!--标题结束-->
		<!--表单内容开始-->
		<div class="ui-form fn-clear">
			<form name="frm" class="" method="post">
				<table id="table1" name="table1" class="ui-table ui-table-form ">
					<tbody class="discolor_form">
						<tr>
						  <td colspan="4">
						  	<div id="infoMessage"></div>
						  </td>
						</tr>
						<tr>
							<td class="ui-form-cl2-l">
								<label for="zs">
									排班名称（<font color="red">*</font>）：
								</label>
							</td>
							<!--left_td_width_01 定义width为30%-->
							<!--label for="id"-->
							<td colspan="3" class="ui-form-cl2-r ">
								<input type="text" id="pbmc" name="kqGlpb.pbmc" reg="^.+$" tip="排班名称不能为空!"/>
							</td>
							<!---input id 标记校验信息 -->
						</tr>
						<tr>
							<td class="ui-form-cl2-l">
								<label for="">
									生效时间（<font color="red">*</font>）：
								</label>
							</td>
							<td class="ui-form-cl2-r">
								<input type="text" id="kssj" name="kqGlpb.kssj" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate" reg="^.+$" tip="生效时间不能为空!"/>
							</td>
							<td class="ui-form-cl2-l">
								<label for="">
									失效时间（<font color="red">*</font>）：
								</label>
							</td>
							<td class="ui-form-cl2-r">
								<input type="text" id="jssj" name="kqGlpb.jssj" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate" reg="^.+$" tip="失效时间不能为空!"/>
							</td>
						</tr>
						<tr>
							<td class="ui-form-cl2-l">
								<label for="zs">
									周期天数（<font color="red">*</font>）：
								</label>
							</td>
							<!--left_td_width_01 定义width为30%-->
							<!--label for="id"-->
							<td colspan="3" class="ui-form-cl2-r ">
								<input type="text" value="1" id="days" name="kqGlpb.zqts" reg="^.+$" tip="周期天数不能为空!"/>
							</td>
						</tr>
						<tr>
							<td class="ui-form-cl2-l">
								<label for="zs">
									人员或部门（<font color="red">*</font>）：
								</label>
							</td>
							<!--left_td_width_01 定义width为30%-->
							<!--label for="id"-->
							<td colspan="3" class="ui-form-cl2-r ">
								<s:hidden name="peopleIds"></s:hidden>
								<s:hidden name="deptIds"></s:hidden>
								<textarea rows="5" cols="2" id="peopleIds" name="peopleNames"  style="width:80%!important;"></textarea><input type="button" onclick="selRyxx()"  value="选择人员"  class="ui-btn ui-btn-normal">
								<textarea rows="5" cols="2" id="deptIds" name="deptNames" style="width:80%!important;"></textarea><input type="button" onclick="selDept()"  value="选择部门"  class="ui-btn ui-btn-normal">
							</td>
						</tr>
						<tr>
							<td colspan="4" align="center">
								<input type="button" value="添加新行" onclick="addNewRow()"/>
							</td>
						</tr>
						<tr>
							<td class="ui-form-cl2-l">
								日期（<font color="red">*</font>）:
							</td>
							<td class="ui-form-cl2-r">
								<input type="text" id="rq0" name="kqGlpbxxList[0].rq" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate"/>
							</td>
							<!--left_td_width_01 定义width为30%-->
							<!--label for="id"-->
							<td class="ui-form-cl2-l">
								班次（<font color="red">*</font>）:
							</td>
							<td class="ui-form-cl2-r">
								<s:select theme="simple" id="bcList0" name="kqGlpbxxList[0].bc" list="kqBcszList" listKey="id" listValue="bcmc" ></s:select>
							</td>
						</tr>
					</tbody>
					<tfoot>
						<tr>
							<td colspan="4">
								<input class="ui-btn ui-btn-normal" type="button" name="button"
									id="" value="生成排班" title="生成排班" onclick="doSubmit()" />
								<input class="ui-btn ui-btn-normal" type="reset" value="重置"
									title="重新填写" />
							</td>
						</tr>
					</tfoot>
				</table>
			</form>
		</div>
		<!--表单内容结束-->
	</body>
</html>
